package com.cdd.common.core.domain.model;

import com.cdd.common.domain.entity.AppUser;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Set;

/**
 * 登录用户身份权限
 *
 * @author lc
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class LoginUser extends BaseLoginUser {

    private static final long serialVersionUID = 1L;

    /**
     * 权限列表
     */
    private Set<String> permissions;

    /**
     * 用户信息
     */
    private AppUser user;

    @JsonIgnore
    public String getPassword()
    {
        return user.getPassword();
    }

    public Integer getUserId() {
        return this.user.getId();
    }

    public String getUsername() {
        return this.user.getLoginname();
    }
}
